﻿<phone:PhoneApplicationPage x:Class="BingMaps.View.LocationPage"
                            xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                            xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
                            xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
                            xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
                            xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
                            xmlns:controls="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls"
                            FontFamily="{StaticResource PhoneFontFamilyNormal}"
                            FontSize="{StaticResource PhoneFontSizeNormal}"
                            Foreground="{StaticResource PhoneForegroundBrush}"
                            SupportedOrientations="Portrait"
                            Orientation="Portrait"
                            mc:Ignorable="d"
                            d:DesignHeight="768"
                            d:DesignWidth="480"
                            shell:SystemTray.IsVisible="True"
                            DataContext="{Binding LocationViewModel, Source={StaticResource Locator}}">

    <!--LayoutRoot is the root grid where all page content is placed-->
    <Grid x:Name="LayoutRoot"
          Background="Transparent">
        <!--Pivot Control-->
        <controls:Pivot Title="BING MAPS SERVICE DEMO">
            <!--Pivot item one-->
            <controls:PivotItem Header="By Point">
                <Grid x:Name="ByPoint"
                      Margin="12,0,12,0">
                    <ScrollViewer Margin="0,0,0,0">
                        <StackPanel Orientation="Vertical"
                                    VerticalAlignment="Top">
                            <TextBlock TextWrapping="Wrap"
                                       Text="Press the 'find' button to get location info:"
                                       d:LayoutOverrides="Height"
                                       VerticalAlignment="Center"
                                       Padding="0,0,0,20" />
                            <StackPanel Orientation="Horizontal">
                                <TextBlock TextWrapping="Wrap"
                                           Text="Latitude:"
                                           d:LayoutOverrides="Height"
                                           VerticalAlignment="Center"
                                           Padding="0,0,28,0" />
                                <TextBlock TextWrapping="Wrap"
                                           Text="{Binding CurrentDeviceGeoCoordinate.Latitude}"
                                           Foreground="Red"
                                           d:LayoutOverrides="Height"
                                           TextAlignment="Right"
                                           Width="327" />
                            </StackPanel>
                            <StackPanel Orientation="Horizontal">
                                <TextBlock TextWrapping="Wrap"
                                           Text="Longitude:"
                                           d:LayoutOverrides="Width"
                                           VerticalAlignment="Center"
                                           Padding="0,0,10,0" />
                                <TextBlock TextWrapping="Wrap"
                                           TextAlignment="Right"
                                           Text="{Binding CurrentDeviceGeoCoordinate.Longitude}"
                                           Foreground="Red"
                                           Width="327" />
                            </StackPanel>
                            <TextBlock TextWrapping="Wrap"
                                       Text="Location info:"
                                       d:LayoutOverrides="Height"
                                       VerticalAlignment="Center"
                                       Padding="0,0,0,20"
                                       Height="33"
                                       Margin="0,20,0,0" />
                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="150"></ColumnDefinition>
                                    <ColumnDefinition Width="*"></ColumnDefinition>
                                </Grid.ColumnDefinitions>
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="30"></RowDefinition>
                                    <RowDefinition Height="30"></RowDefinition>
                                    <RowDefinition Height="30"></RowDefinition>
                                    <RowDefinition Height="30"></RowDefinition>
                                    <RowDefinition Height="30"></RowDefinition>
                                    <RowDefinition Height="60"></RowDefinition>
                                    <RowDefinition Height="30"></RowDefinition>
                                    <RowDefinition Height="30"></RowDefinition>
                                    <RowDefinition Height="30"></RowDefinition>
                                </Grid.RowDefinitions>
                                <TextBlock Text="Bing Confidence:" />
                                <TextBlock Text="{Binding LocationDataByPoint.Confidence}"
                                           Foreground="LightGreen"
                                           TextAlignment="Right"
                                           Padding="0,0,20,0"
                                           Grid.Column="1" />
                                <TextBlock Text="Name:"
                                           Grid.Row="1" />
                                <TextBlock Text="{Binding LocationDataByPoint.Name}"
                                           Foreground="LightGreen"
                                           TextAlignment="Right"
                                           Padding="0,0,20,0"
                                           Grid.Column="1"
                                           Grid.Row="1" />
                                <TextBlock Text="Address Line:"
                                           Grid.Row="2" />
                                <TextBlock Text="{Binding LocationDataByPoint.Address.AddressLine}"
                                           Foreground="LightGreen"
                                           TextAlignment="Right"
                                           Padding="0,0,20,0"
                                           Grid.Column="1"
                                           Grid.Row="2" />
                                <TextBlock Text="Admin District:"
                                           Grid.Row="3" />
                                <TextBlock Text="{Binding LocationDataByPoint.Address.AdminDistrict}"
                                           Foreground="LightGreen"
                                           TextAlignment="Right"
                                           Padding="0,0,20,0"
                                           Grid.Column="1"
                                           Grid.Row="3" />
                                <TextBlock Text="Country Region:"
                                           Grid.Row="4" />
                                <TextBlock Text="{Binding LocationDataByPoint.Address.CountryRegion}"
                                           Foreground="LightGreen"
                                           TextAlignment="Right"
                                           Padding="0,0,20,0"
                                           Grid.Column="1"
                                           Grid.Row="4" />
                                <TextBlock Text="Formatted Address:"
                                           TextWrapping="Wrap"
                                           Grid.Row="5" />
                                <TextBlock Text="{Binding LocationDataByPoint.Address.FormattedAddress}"
                                           Foreground="LightGreen"
                                           TextAlignment="Right"
                                           TextWrapping="Wrap"
                                           Padding="0,0,20,0"
                                           Grid.Column="1"
                                           Grid.Row="5" />
                                <TextBlock Text="Locality:"
                                           Grid.Row="6" />
                                <TextBlock Text="{Binding LocationDataByPoint.Address.Locality}"
                                           Foreground="LightGreen"
                                           TextAlignment="Right"
                                           Padding="0,0,20,0"
                                           Grid.Column="1"
                                           Grid.Row="6" />
                                <TextBlock Text="Postal Code:"
                                           Grid.Row="7" />
                                <TextBlock Text="{Binding LocationDataByPoint.Address.PostalCode}"
                                           Foreground="LightGreen"
                                           TextAlignment="Right"
                                           Padding="0,0,20,0"
                                           Grid.Column="1"
                                           Grid.Row="7" />
                            </Grid>
                        </StackPanel>
                    </ScrollViewer>
                    <Button Content="Clear"
                            Command="{Binding SelectClearLocationByPointCommand}"
                            Margin="0,0,150,0"
                            HorizontalAlignment="Right"
                            Grid.Row="1"
                            VerticalAlignment="Bottom" />
                    <Button Content="Location"
                            Command="{Binding SelectFindMyCurrentLocationCommand}"
                            Margin="0,0,0,0"
                            HorizontalAlignment="Right"
                            Grid.Row="1"
                            VerticalAlignment="Bottom" />
                </Grid>
            </controls:PivotItem>

            <!--Pivot item two-->
            <controls:PivotItem Header="By Address">
                <Grid x:Name="ByAddress"
                      Margin="12,0,12,0"
                      Grid.Row="1">
                    <Grid.RowDefinitions>
                        <RowDefinition />
                    </Grid.RowDefinitions>
                    <ScrollViewer Margin="0,0,0,0">
                        <Grid>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="65"></RowDefinition>
                                <RowDefinition Height="65"></RowDefinition>
                                <RowDefinition Height="65"></RowDefinition>
                                <RowDefinition Height="65"></RowDefinition>
                                <RowDefinition Height="65"></RowDefinition>
                                <RowDefinition Height="65"></RowDefinition>
                                <RowDefinition Height="65"></RowDefinition>
                            </Grid.RowDefinitions>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="159"></ColumnDefinition>
                                <ColumnDefinition Width="297"></ColumnDefinition>
                            </Grid.ColumnDefinitions>
                            <TextBlock Text="Address Line:"
                                       TextWrapping="Wrap"
                                       Padding="0,0,0,0"
                                       VerticalAlignment="Center"
                                       Width="136"
                                       Margin="20,16,4,16" />
                            <TextBox Grid.Column="1"
                                     Text="{Binding Address.AddressLine, Mode=TwoWay}"
                                     FontSize="20"
                                     Margin="0,0,0,0" />
                            <TextBlock Grid.Row="1"
                                       Text="Admin District:"
                                       TextWrapping="Wrap"
                                       Padding="0,0,0,0"
                                       VerticalAlignment="Center"
                                       Width="136"
                                       Margin="20,16,4,16" />
                            <TextBox Grid.Row="1"
                                     Grid.Column="1"
                                     Text="{Binding Address.AdminDistrict, Mode=TwoWay}"
                                     FontSize="20"
                                     Margin="0,0,0,0" />
                            <TextBlock Grid.Row="2"
                                       Text="Confidence:"
                                       TextWrapping="Wrap"
                                       Padding="0,0,0,0"
                                       VerticalAlignment="Center"
                                       Width="136"
                                       Margin="20,16,4,16" />
                            <TextBox Grid.Row="2"
                                     Grid.Column="1"
                                     Text="{Binding Address.Confidence, Mode=TwoWay}"
                                     FontSize="20"
                                     Margin="0,0,0,0" />
                            <TextBlock Grid.Row="3"
                                       Text="Country Region:"
                                       TextWrapping="Wrap"
                                       Padding="0,0,0,0"
                                       VerticalAlignment="Center"
                                       Width="136"
                                       Margin="20,3,4,3" />
                            <TextBox Grid.Row="3"
                                     Grid.Column="1"
                                     Text="{Binding Address.CountryRegion, Mode=TwoWay}"
                                     FontSize="20"
                                     Margin="0,0,0,0" />
                            <TextBlock Grid.Row="4"
                                       Text="Formatted Address:"
                                       TextWrapping="Wrap"
                                       Padding="0,0,0,0"
                                       VerticalAlignment="Center"
                                       Width="136"
                                       Margin="20,3,4,3" />
                            <TextBox Grid.Row="4"
                                     Grid.Column="1"
                                     Text="{Binding Address.FormattedAddress, Mode=TwoWay}"
                                     FontSize="20"
                                     Margin="0,0,0,0" />
                            <TextBlock Grid.Row="5"
                                       Text="Locality:"
                                       TextWrapping="Wrap"
                                       Padding="0,0,0,0"
                                       VerticalAlignment="Center"
                                       Width="136"
                                       Margin="20,16,4,16" />
                            <TextBox Grid.Row="5"
                                     Grid.Column="1"
                                     Text="{Binding Address.Locality, Mode=TwoWay}"
                                     FontSize="20"
                                     Margin="0,0,0,0" />
                            <TextBlock Grid.Row="6"
                                       Text="Postal Code:"
                                       TextWrapping="Wrap"
                                       Padding="0,0,0,0"
                                       VerticalAlignment="Center"
                                       Width="136"
                                       Margin="20,16,4,16" />
                            <TextBox Grid.Row="6"
                                     Grid.Column="1"
                                     Text="{Binding Address.PostalCode, Mode=TwoWay}"
                                     FontSize="20"
                                     Margin="0,0,0,0" />
                        </Grid>
                    </ScrollViewer>
                    <Button Content="Clear"
                            Command="{Binding SelectClearLocationByAddressCommand}"
                            Margin="0,0,100,0"
                            HorizontalAlignment="Right"
                            Grid.Row="1"
                            VerticalAlignment="Bottom" />
                    <Button Content="Find"
                            Command="{Binding SelectSearchLocationByAddressCommand}"
                            Margin="0,0,0,0"
                            HorizontalAlignment="Right"
                            Grid.Row="1"
                            VerticalAlignment="Bottom" />
                </Grid>
            </controls:PivotItem>
        </controls:Pivot>

        <Button x:Name="ScreenShot"
                Click="ScreenShot_Click"
                Content="."
                VerticalAlignment="Bottom"
                HorizontalAlignment="Left" />
    </Grid>

</phone:PhoneApplicationPage>
